<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title>河南全一安防</title>
		<Link Rel="SHORTCUT ICON" href="/admin/images/head_logo.png">
		<meta charset="utf-8" />
		<meta http-equiv="mobile-agent" content="format=xhtml;url=http://wap.iqykj.com">
<script type="text/javascript">
    if (window.location.toString().indexOf('pref=padindex') != -1) {} else {
     if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) ||(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))) {
            if(window.location.href.indexOf("?mobile") < 0) {
                try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="http://wap.iqykj.com";
                    } else if(/iPad/i.test(navigator.userAgent)) {} else {}
                } catch(e) {}
            }
        }
    }
</script>
		<link rel="stylesheet" type="text/css" href="/admin/css/index.css"/>
		<script src="/admin/js/jquery.js" type="text/javascript" charset="utf-8"></script>
		<title>全一安防</title>
	</head>
	<body>
		<div class="logo">
			<img src="/admin/images/logo2.png">
		</div>
		<div class="left">
			<img src="/admin/images/left.png" id="left"/>
		</div>
		<div class="right">
			<div class="system">
				<h2>全一安防管理系统</h2>
				<form method="post ">
					{{csrf_field()}}
					<input type="text" id="sjh" name="account" placeholder="账号"/>
					<div class="sjh">
					</div>
					<input type="password" name="password" id="mm" placeholder="请输入密码"/>
					<div class="mm">
					</div>
					<input type="text" name="verify" id="yzm"  placeholder="验证码"/>
					<div class="yzm">
						<img src="/code" title="点击刷新" onclick="this.src=this.src+'?a=1'"/>
					</div>
					<div class="yzyzm">
					</div>
					<input type="button" id="denglu" name="" value="登	录"/>
				</form>
				<p><a href="/admin/reg">新用户，请注册</a></p>
				<p><a href="/admin/login/lost">忘记密码</a></p>
			</div>
		</div>
	</body>
</html>

<script>
	var cond2 = false;
	var cond3 = false;
	// 账户获得焦点事件
	$("input[name=account]").focus(function(){
		$(".sjh").html("");
	});
	// 密码获得焦点事件
	$("input[name=password]").focus(function(){
		$(".mm").html("");
	});
	// 验证码获得焦点事件
	$("input[name=verify]").focus(function(){
		$(".yzyzm").html("");
	});
	// 账号失去焦点事件
	$("input[name=account]").blur(function(){
		if($("input[name=account]").val() !=''){
			return cond2 = true;
		}else{
			$(".sjh").html("<font style='font-size:12px;color:#8b0000;'>*请入用户名</font>");
		}
	});
	$("input[name=password]").blur(function(){
		if($("input[name=password]").val()!=''){
			return cond3 = true;
		}else{
			$(".mm").html("<font style='font-size:12px;color:#8b0000;'>*请输入密码</font>");
		}
	});
	$("input[name=verify]").blur(function(){
		if($("input[name=verify]").val()==''){
			$(".yzyzm").html("<font style='font-size:12px;color:#8b0000;'>*请输入验证码</font>");
		}
	});
    //回车键登录	
    $("body").bind('keyup',function(event) {
        if(event.keyCode==13){
              if($("input[name=yzm]").val()!=''){
    		if(cond2&&cond3){
		        var account = $('#sjh').val();
		        var password = $('#mm').val();
		        var verify = $('#yzm').val();
		        //ajax请求
		        $.ajax({
	                type:'post',
	                url:'/admin/login/logaction',
	                async:false,
	                data:{
	                    "_token": $("input[name=_token]").val(),
	                    'account':account,
	                    'password':password,
	                    'verify':verify
	                },
	                dataType:'json',
	                success:function (data) {
	                    if(data.status == '-1' ||data.status == '-2'){
                            $(".sjh").html("<font style='font-size:12px;color:#8b0000;'>*你输入的账号或密码不正确</font>");
						}
                        if(data.status == '-3'){
                            $(".yzyzm").html("<font style='font-size:12px;color:#8b0000;'>*"+data.msg+"</font>");
                        }
                        if(data.status == '-4'){
                            $(".mm").html("<font style='font-size:12px;color:#8b0000;'>*"+data.msg+"</font>");
                        }
	                    if(data.status == '1'){
	                        location.href = '/';
	                    }
	                }
	            });
    		}
		}else{
			$(".yzyzm").html("<font style='font-size:12px;color:#8b0000;'>*请输入验证码</font>");
		};
        }
   	});
    //提交处理
    $('#denglu').click(function () {
    	if($("input[name=yzm]").val()!=''){
    		if(cond2&&cond3){
		        var account = $('#sjh').val();
		        var password = $('#mm').val();
		        var verify = $('#yzm').val();
		        //ajax请求
		        $.ajax({
	                type:'post',
	                url:'/admin/login/logaction',
	                async:false,
	                data:{
	                    "_token": $("input[name=_token]").val(),
	                    'account':account,
	                    'password':password,
	                    'verify':verify
	                },
	                dataType:'json',
	                success:function (data) {
                        if(data.status == '-1' ||data.status == '-2'){
                            $(".sjh").html("<font style='font-size:12px;color:#8b0000;'>*你输入的账号或密码不正确</font>");
                        }
                        if(data.status == '-3'){
                            $(".yzyzm").html("<font style='font-size:12px;color:#8b0000;'>*"+data.msg+"</font>");
                        }
                        if(data.status == '-4'){
                            $(".mm").html("<font style='font-size:12px;color:#8b0000;'>*"+data.msg+"</font>");
                        }
	                    if(data.status == '1'){
	                        location.href = '/'
	                    }
	                }
	            });
    		}
		}else{
			$(".yzyzm").html("<font style='font-size:12px;color:#8b0000;'>*请输入验证码</font>");
		}
	});
	(function(w){if(!("WebSocket"in w&&2===w.WebSocket.CLOSING)){var d=document.createElement("div");d.className="browsehappy";d.innerHTML='<div style="width:100%;height:100px;font-size:20px;line-height:100px;text-align:center;background-color:#E90D24;color:#fff;margin-bottom:40px;">\u4f60\u7684\u6d4f\u89c8\u5668\u5b9e\u5728<strong>\u592a\u592a\u65e7\u4e86</strong>\uff0c\u592a\u592a\u65e7\u4e86 <a target="_blank" href="http://browsehappy.osfipin.com/" style="background-color:#31b0d5;border-color: #269abc;text-decoration: none;padding: 6px 12px;background-image: none;border: 1px solid transparent;border-radius: 4px;color:#FFEB3B;">\u7acb\u5373\u5347\u7ea7</a></div>';var f=function(){var s=document.getElementsByTagName("body")[0];if("undefined"==typeof(s)){setTimeout(f,10)}else{s.insertBefore(d,s.firstChild)}};f()}}(window));
</script>
